<template>
  <div class="app-container"  > 
    <el-form ref="form" :model="form" label-width="125px">
      <div>
        <p1>设备</p1>
    <el-select v-model="choose_devName" clearable placeholder="请选择" style="width : 15%">
      <el-option
        v-for="item in list"
        :key="item.devName"
        :label="item.label"
        :value="item.devName">
      </el-option>
    </el-select>
<!-- [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object] 
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]--> 
    <p1>位置</p1>
    <el-select v-model="choose_devPosition" clearable placeholder="请选择" style="width : 15%">
      <el-option
        v-for="item in list"
        :key="item.devPosition"
        :label="item.label"
        :value="item.devPosition">
      </el-option>
    </el-select>    
    <p1>设备型号</p1>
    <el-select v-model="choose_devModel" clearable placeholder="请选择" style="width : 15%">
      <el-option
        v-for="item in list"
        :key="item.devModel"
        :label="item.label"
        :value="item.devModel">
      </el-option>
    </el-select>
      </div>
  <br>
  <br>

      <div class="block">
        <span class="demonstration">默认</span>
        <el-date-picker
          v-model="value6"
          type="daterange"
          range-separator="——"
          start-placeholder="开始日期"
          end-placeholder="结束日期">
        </el-date-picker>
      </div>
  <br>
  <br>

  <el-table
    :data="tableData3"
    style="width: 100%"
    ref="multipleTable"
    tooltip-effect="dark"
    @selection-change="handleSelectionChange">
    <el-table-column
      border
      fixed = "left"
      prop="date"
      label="时间"
      width="120"
      align="center">
    </el-table-column>
    <el-table-column
      prop="name"
      label="2019/03/21"
      width="200"
      align="center">
      <template slot-scope="scope">
        <el-tooltip class="item" effect="light" content="申请" placement="bottom">
        <el-button type="primary" border disabled>申请</el-button>
        </el-tooltip>
      </template>
    </el-table-column>
    <el-table-column
      prop="province"
      label="2019/03/22"
      width="200"
      align="center">
      <template slot-scope="scope">
        <el-tooltip class="item" effect="light" content="申请" placement="bottom">
        <el-button type="text"  >申请</el-button>
        </el-tooltip>
      </template>
    </el-table-column>
    <el-table-column
      prop="city"
      label="2019/03/23"
      width="200"
      align="center">
      <template slot-scope="scope">
        <el-tooltip class="item" effect="light" content="申请" placement="bottom">
        <el-button type="text"  >申请</el-button>
        </el-tooltip>
      </template>
    </el-table-column>
    <el-table-column
      prop="address"
      label="2019/03/24"
      width="200"
      align="center">
      <template slot-scope="scope">
        <el-tooltip class="item" effect="light" content="申请" placement="bottom">
        <el-button type="text"  >申请</el-button>
        </el-tooltip>
      </template>
    </el-table-column>
    <el-table-column
      prop="zip"
      label="2019/03/25"
      width="200"
      align="center">
      <template slot-scope="scope">
        <el-tooltip class="item" effect="light" content="申请" placement="bottom">
        <el-button type="text" :type="button" @click="choose" >申请</el-button>
        </el-tooltip>
      </template>
    </el-table-column>
    <el-table-column
      prop="zip"
      label="2019/03/26"
      width="200"
      align="center">
      <template slot-scope="scope">
       <el-tooltip class="item" effect="light" content="申请" placement="bottom">
        <el-button type="text"  >申请</el-button>
        </el-tooltip>
      </template>
    </el-table-column>
    <el-table-column
      prop="zip"
      label="2019/03/27"
      width="200"
      align="center">
      <template slot-scope="scope">
        <el-tooltip class="item" effect="light" content="申请" placement="bottom">
        <el-button type="text"  >申请</el-button>
        </el-tooltip>
      </template>
    </el-table-column>
  </el-table>

  <br>
  <br>



    <div>
      <el-select v-model="choose_funcation" clearable placeholder="请选择" style="width : 15%">
        <el-option
          v-for="item in list"
          :key="item.funcation"
          :label="item.label"
          :value="item.funcation">
        </el-option>
      </el-select>
    </div>
  <div style="float : right">
  <el-button type="primary" icon="plus"  @click="showCreate()">立即申请</el-button>
  </div>

<el-dialog :title="title" :visible.sync="dialogFormVisible">
      <el-form class="small-space"  label-position="left" label-width="100px">
        <el-form-item label="时间(起始)：">
         <el-input v-model="input" ></el-input> 
        </el-form-item>
        <el-form-item label="时间(截止)：">
          <el-input v-model="input" ></el-input>
        </el-form-item>
        <el-form-item label="使用位置：">
          <el-input v-model="input" ></el-input>
        </el-form-item>
        <el-form-item label="设备：">
          <el-input v-model="input" ></el-input>
        </el-form-item>
        <el-form-item label="设备ID：">
          <el-input v-model="input" ></el-input>
        </el-form-item>
        <el-form-item label="设备功能：">
          <el-input v-model="input" ></el-input>
        </el-form-item>

      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button  type="success" @click="open()" >确 定</el-button>
        <el-button @click="dialogFormVisible = false">取 消</el-button>
      </div>
    </el-dialog>

    </el-form>
  </div>
</template>
<script>
  export default {
    data() {
      return {
         list: {
          value:'',
          label:''
        },
        choose_devName:'',
        choose_devPosition:'',
        choose_devModel: '',
        choose_funcation: '',

        button: '',
        input: '',
        listLoading: false,//数据加载等待动画
        dialogFormVisible: false,//增加按钮弹窗能不能看到
        adminName: '管理员' ,
        title: '预约申请概况',
        form: {
          name: '',
          region: '',
          date1: '',
          date2: '',
          delivery: false,
          type: [],
          resource: '',
          desc: ''
        },
        pickerOptions2: {
          shortcuts: [{
            text: '最近一周',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近一个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
              picker.$emit('pick', [start, end]);
            }
          }, {
            text: '最近三个月',
            onClick(picker) {
              const end = new Date();
              const start = new Date();
              start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
              picker.$emit('pick', [start, end]);
            }
          }]
        },
        value6: '',
        value7: '',

      tableData3: [{
          date: '早上:8.00-11.30',
          name: '王小虎',
          province: '上海',
          city: '普陀区',
          address: '上海市普陀区金沙江路 1518 弄',
          zip: 200333
        }, {
          date: '下午:1.30-5.30',
          name: '王小虎',
          province: '上海',
          city: '普陀区',
          address: '上海市普陀区金沙江路 1518 弄',
          zip: 200333
        }, {
          date: '晚上:7.30-11.30',
          name: '王小虎',
          province: '上海',
          city: '普陀区',
          address: '上海市普陀区金沙江路 1518 弄',
          zip: 200333
        }
        ],
        /*cellStyle(row,column,rowIndex,columnIndex){
          if(row.column.label == '')
          return ;
        }*/
      }
    },
    created() {//钩子函数创建时调用
      this.getList();
    },
    methods: {
      getList() {
        //查询列表
        this.listLoading = true;
        this.api({
          url: "/devices/listDevices",
          method: "get",
          params: this.listQuery
        }).then(data => {
          this.listLoading = false;
          this.list = data.list;
          this.totalCount = data.totalCount;
        })
      },
      choose(){
        this.button = 'primary'
      },
      open() {
        this.$message({
          message: '恭喜你，预约成功！',
          type: 'success'
        });
      },
      showCreate() {
        this.dialogFormVisible = true;//显示弹窗
      },
      onSubmit() {
          console.log('submit!');
      }
    }
  }
</script>
<style scoped>
  .requiredPerm {
    color: #683e3f;
  }
</style>
